package com.muje.android.toiletcard;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MenuActivity extends Activity {

	private Button addPlayerButton;
	private Button startButton;
	private Button helpButton;

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.menu);

		addPlayerButton = (Button) this.findViewById(R.id.addPlayerButton);
		addPlayerButton.setOnClickListener(addPlayerOnClick);

		startButton = (Button) this.findViewById(R.id.startButton);
		startButton.setOnClickListener(startOnClick);

		helpButton = (Button) this.findViewById(R.id.helpButton);
		helpButton.setOnClickListener(helpOnClick);

		//test();// debug
	}

	protected OnClickListener addPlayerOnClick = new OnClickListener() {

		public void onClick(View v) {
			launchSetup();
		}
	};
	protected OnClickListener startOnClick = new OnClickListener() {

		public void onClick(View v) {
			launchGame();
		}
	};
	protected OnClickListener helpOnClick = new OnClickListener() {

		public void onClick(View v) {
			launchGame();
		}
	};

	private void launchSetup() {
		startActivity(new Intent(this, PlayerSetupActivity.class));
		finish();
	}

	private void launchGame() {
		startActivity(new Intent(this, DisplayActivity.class));
		finish();
	}

	private void test() {

		Poker poker = new Poker(this);

		Player player = new Player("Ali");
		//player.Cards.add(poker.Cards.get(25));
		player.Cards.add(poker.Cards.get(37));
		player.Cards.add(poker.Cards.get(46));
		poker.addPlayer(player);

//		PlayerControl playerControl1 = (PlayerControl) findViewById(R.id.playerControl1);
//		playerControl1.setPoker(poker);
//		playerControl1.updatePlayer(player);
	}

}
